package com.ziqikeji.MVC;

import com.ziqikeji.businessDelegate.BusinessDelegate;

/**
 * MVC模式 DefaultController
 * Created by lynes on 2018/7/3.
 */
public class StudentController {
    private Student model;
    private StudentView view;
    private BusinessDelegate businessDelegate;


    public StudentController(Student model, StudentView view){
        this.model = model;
        this.view = view;

        businessDelegate = new BusinessDelegate();
        businessDelegate.setServiceType("EJB");
    }

    public void setStudentName(String name){
        model.setName(name);
    }

    public String getStudentName(){
        return model.getName();
    }

    public void setStudentRollNo(String rollNo){
        model.setRollNo(rollNo);
    }

    public String getStudentRollNo(){
        return model.getRollNo();
    }

    public void updateView(){
        view.printStudentDetails(model.getName(), model.getRollNo());
        businessDelegate.doTask();
    }
}
